package com.alks.function.controller.chengKong;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.chengKong.*;
import com.alks.function.service.chengKong.LargeCargoUsageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

@ApiRestController("/Cargo")
@Api(tags = {"成控部-物料管理作业-大货用量建档"})
@Slf4j
public class LargeCargoUsageController {

    @Resource
    private LargeCargoUsageService largeCargoUsageService;

    @WebLogger
    @PostMapping("/getDevelopBom")
    @ApiOperation(value = "取研发BOM",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getDevelopBom(@RequestBody Map<String,String> map){
        return largeCargoUsageService.getDevelopBom(map);
    }

    @WebLogger
    @PostMapping("/getDevelopBomList")
    @ApiOperation(value = "查询",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getDevelopBomList(@RequestBody UsageDetailsQueryChangeRequest request){
        return largeCargoUsageService.getDevelopBomList(request);
    }

    @WebLogger
    @PostMapping("/getDevelopBomPhotoList")
    @ApiOperation(value = "型体图片查询",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getDevelopBomPhotoList(@RequestBody UsageDetailsQueryChangeRequest request){
        return largeCargoUsageService.getDevelopBomPhotoList(request);
    }

    @WebLogger
    @PostMapping("/getDevelopBomUsageList")
    @ApiOperation(value = "用量明细资料查询",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getDevelopBomUsageList(@RequestBody StyleNoToColorRequest request){
        return largeCargoUsageService.getDevelopBomUsageList(request);
    }

    @WebLogger
    @PostMapping("/getCheckOut/{choose}")
    @ApiOperation(value = "0检核/1取消检核",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getCheckOut2(@RequestBody StyleNoToColorRequest request, @PathVariable("choose") Integer choose){
        return largeCargoUsageService.getCheckOut(request,choose);
    }

    @WebLogger
    @PostMapping("/getNotesForFiling")
    @ApiOperation(value = "注意事项建档-插入事项名称",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getNotesForFiling(@RequestBody StyleNoToColorRequest request){
        return largeCargoUsageService.getNotesForFiling(request);
    }

    @WebLogger
    @PostMapping("/getNotesForFilingList")
    @ApiOperation(value = "注意事项建档查询",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getNotesForFilingList(@RequestBody StyleNoToColorRequest request){
        return largeCargoUsageService.getNotesForFilingList(request);
    }

    @WebLogger
    @PostMapping("/getNotesForFilingSave")
    @ApiOperation(value = "注意事项建档-保存",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getNotesForFilingSave(@RequestBody PrecautionsForFilingUpdateRequest request){
        return largeCargoUsageService.getNotesForFilingSave(request);
    }

    @WebLogger
    @PostMapping("/getDevelopBomUsageSave")
    @ApiOperation(value = "保存",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getDevelopBomUsageSave(@RequestBody StyleColorMaterialAddRequest request){
        return largeCargoUsageService.getDevelopBomUsageSave(request);
    }

    @WebLogger
    @PostMapping("/updateBaseSize")
    @ApiOperation(value = "修改基本码",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo updateBaseSize(@RequestBody StyleColorMaterialAddRequest request){
        return largeCargoUsageService.updateBaseSize(request);
    }

    @WebLogger
    @PostMapping("/getReordering")
    @ApiOperation(value = "重排序号",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getReordering2(@RequestBody StyleNoToColorRequest request){
        return largeCargoUsageService.getReordering(request);
    }

    @WebLogger
    @PostMapping("/getDeleteTickRecords")
    @ApiOperation(value = "删除打勾记录",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getDeleteTick2Records(@RequestBody StyleR2DDelRequest request){
        return largeCargoUsageService.getDeleteTickRecords(request);
    }

    @WebLogger
    @PostMapping("/getCopyingDosageList")
    @ApiOperation(value = "复制用量列表",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getCopyingDosageList2(@RequestBody CopyingDosageQueryRequest request){
        return largeCargoUsageService.getCopyingDosageList(request);
    }

    @WebLogger
    @PostMapping("/getCopyingDosage")
    @ApiOperation(value = "复制用量",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getCopying2Dosage(@RequestBody CopyingDosageRequest request){
        return largeCargoUsageService.getCopyingDosage(request);
    }

    @WebLogger
    @PostMapping("/getDeleteBomStyleColor")
    @ApiOperation(value = "BOM资料删除",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getDeleteBomStyleColor(@RequestBody StyleNoToColorRequest request){
        return largeCargoUsageService.getDeleteBomStyleColor(request);
    }

    @WebLogger
    @PostMapping("/getPartUsage")
    @ApiOperation(value = "级放部位全码用量",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getPartUsage(@RequestBody SizeUsageRequest request){
        return largeCargoUsageService.getPartUsage(request);
    }

    @WebLogger
    @PostMapping("/getFullCodeSizeList")
    @ApiOperation(value = "全码用量资料查询",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getFullCodeSizeList(@RequestBody FullCodeRenewGetRequest request){
        return largeCargoUsageService.getFullCodeSizeList(request);
    }

    @WebLogger
    @PostMapping("/getFullCodeSizeDel")
    @ApiOperation(value = "删除全码用量",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getFullCodeSizeDel(@RequestBody FullCodeRenewRequest request){
        return largeCargoUsageService.getFullCodeSizeDel(request);
    }

    @WebLogger
    @PostMapping("/getFullCodeDetailRenewA2U")
    @ApiOperation(value = "全码用量新增修改",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getFullCodeDetailRenewA2U(@RequestBody FullCodeRenewRequest request){
        return largeCargoUsageService.getFullCodeDetailRenewA2U(request);
    }

    @WebLogger
    @PostMapping("/getDetailsOfAdhesiveSubMaterial")
    @ApiOperation(value = "贴合子材料明细",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getDetailsOfAdhesiveSubMaterial(@RequestBody Map<String,String> map){
        return largeCargoUsageService.getDetailsOfAdhesiveSubMaterial(map);
    }

    @WebLogger
    @PostMapping("/getDetailsOfAdhesiveSubMaterialUpdate/{choose}")
    @ApiOperation(value = "贴合子材料明细-修改",tags = "成控部-物料管理作业-大货用量建档")
    public ResponseInfo getDetailsOfAdhesiveSubMaterialUpdate(@RequestBody Map<String,String> map, @PathVariable("choose") @ApiParam("0 请购,1不请购") Integer choose ){
        return largeCargoUsageService.getDetailsOfAdhesiveSubMaterialUpdate(map,choose);
    }

    @WebLogger
    @PostMapping("/bomExport")
    @ApiOperation(value = "bom表导出",tags = "成控部-物料管理作业-大货用量建档")
    public void bomExport(@RequestBody UsageDetailsQueryChangeRequest request, HttpServletResponse response){
        largeCargoUsageService.bomExport(request,response);
    }
}
